/**
 * @function getDeepElementFromPoint
 * @param {number} x
 * @param {number} y
 * @return {Element | null}
 */
export const getDeepElementFromPoint = (x,y) => {
    let target = document.elementFromPoint(x, y);
    while (target?.shadowRoot) {
        const innerTarget = (
            target.shadowRoot
    ).elementFromPoint(x, y);
        if (!innerTarget || innerTarget === target) {
            break;
        }
        target = innerTarget;
    }
    return target;
};
